Class Logger

Summary

Fully Qualified Name: CodeIgniter\Log\Logger
Implements: LoggerInterface

Description

The CodeIgntier Logger

The message MUST be a string or object implementing __toString().

The message MAY contain placeholders in the form: {foo} where foo will be replaced by the context data in key "foo".

The context array can contain arbitrary data, the only assumption that can be made by implementors is that if an Exception instance is given to produce a stack trace, it MUST be in a key named "exception".

Methods

Name Description Defined By
__construct() Constructor. Logger
alert() Action must be taken immediately. Logger
critical() Critical conditions. Logger
debug() Detailed debug information. Logger
determineFile() Determines the file and line that the logging call was made from by analyzing the backtrace. Logger
emergency() System is unusable. Logger
error() Runtime errors that do not require immediate action but should typically be logged and monitored. Logger
info() Interesting events. Logger
log() Logs with an arbitrary level. Logger
notice() Normal but significant events. Logger
warning() Exceptional occurrences that are not errors. Logger

Method Details

__construct()

Constructor.

Parameter Name Type Description
$config \Config\Logger
$debug bool

Returns:

alert()

Action must be taken immediately.

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

Parameter Name Type Description
$message string
$context array

Returns: bool

critical()

Critical conditions.

Example: Application component unavailable, unexpected exception.

Parameter Name Type Description
$message string
$context array

Returns: bool

debug()

Detailed debug information.

Parameter Name Type Description
$message string
$context array

Returns: bool

determineFile()

Determines the file and line that the logging call was made from by analyzing the backtrace.

Find the earliest stack frame that is part of our logging system.

Returns: array

emergency()

System is unusable.

Parameter Name Type Description
$message string
$context array

Returns: bool

error()

Runtime errors that do not require immediate action but should typically be logged and monitored.

Parameter Name Type Description
$message string
$context array

Returns: bool

info()

Interesting events.

Example: User logs in, SQL logs.

Parameter Name Type Description
$message string
$context array

Returns: bool

log()

Logs with an arbitrary level.

Parameter Name Type Description
$level mixed
$message string
$context array

Returns: bool

notice()

Normal but significant events.

Parameter Name Type Description
$message string
$context array

Returns: bool

warning()

Exceptional occurrences that are not errors.

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

Parameter Name Type Description
$message string
$context array

Returns: bool

Top